﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RelationExpertSystem.Relation
{
    public class Grandchild : RelationBase
    {
        private static Grandchild _singleton = new Grandchild();
        public static Grandchild Instance
        {
            get { return _singleton; }
        }

        private Grandchild() { }

        public override bool IsRelated(Person a, Person b)
        {
            // b is a's Grandchild IFF a is b's Grandparent
            return b.KnownRelation(Grandparent.Instance, a);
        }

        public override IEnumerable<IRelation> GetDependencies()
        {
            return new HashSet<IRelation>(new IRelation[] { Grandparent.Instance } );
        }
    }
}
